package com.wit.coursesystem.dao;

import android.database.sqlite.SQLiteDatabase;

import java.util.Map;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.identityscope.IdentityScopeType;
import de.greenrobot.dao.internal.DaoConfig;


import com.wit.coursesystem.dao.StudentDao;
import com.wit.coursesystem.dao.CourseDao;
import com.wit.coursesystem.dao.StudentCourseDao;
import com.wit.coursesystem.entity.Course;
import com.wit.coursesystem.entity.Student;
import com.wit.coursesystem.entity.StudentCourse;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see de.greenrobot.dao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig studentDaoConfig;
    private final DaoConfig courseDaoConfig;
    private final DaoConfig studentCourseDaoConfig;

    private final StudentDao studentDao;
    private final CourseDao courseDao;
    private final StudentCourseDao studentCourseDao;

    public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        studentDaoConfig = daoConfigMap.get(StudentDao.class).clone();
        studentDaoConfig.initIdentityScope(type);

        courseDaoConfig = daoConfigMap.get(CourseDao.class).clone();
        courseDaoConfig.initIdentityScope(type);

        studentCourseDaoConfig = daoConfigMap.get(StudentCourseDao.class).clone();
        studentCourseDaoConfig.initIdentityScope(type);

        studentDao = new StudentDao(studentDaoConfig, this);
        courseDao = new CourseDao(courseDaoConfig, this);
        studentCourseDao = new StudentCourseDao(studentCourseDaoConfig, this);

        registerDao(Student.class, studentDao);
        registerDao(Course.class, courseDao);
        registerDao(StudentCourse.class, studentCourseDao);
    }
    
    public void clear() {
        studentDaoConfig.getIdentityScope().clear();
        courseDaoConfig.getIdentityScope().clear();
        studentCourseDaoConfig.getIdentityScope().clear();
    }

    public StudentDao getStudentDao() {
        return studentDao;
    }

    public CourseDao getCourseDao() {
        return courseDao;
    }

    public StudentCourseDao getStudentCourseDao() {
        return studentCourseDao;
    }

}
